import request from "@/utils/request";

let url = '/smartstudio/device'
export default {
    addDevice(data) {
        return request.post(url, data)
    },
    deleteAll(data) {
        return request.delete(url + "/removeDeviceAll", {data})
    },
    selectDevicePage(page, pageSize, name) {
        return request.get(url, {
            params: {
                page: page,
                pageSize: pageSize,
                name: name
            }
        })
    },

    disableDevice(data) {
        return request.patch(url, data)
    },
    change(data) {
        return request.patch(url + '/change', data)
    },

    deleteDevice(data) {
        return request.delete(url, {data})
    },

    updateDevice(data) {
        return request.put(url, data)
    },

    deviceCount() {
        return request.get(url + '/count')
    },

    rebootDevice(datas) {
        return request.get(url + '/rebootDevice', {
            params: {
                data: datas
            }
        })
    },

    searchDeviceBySearchValues(searchValues) {
        return request.post(url + '/searchDeviceBySearchValues', searchValues)
    },
    getList(page, pageSize, name) {
        return request.get(url + '/getList', {
            params: {
                page: page,
                pageSize: pageSize,
                name: name
            }
        })

    },

    setTime(data) {
        return request.post(url + "/setTime", data)
    },

    selectAreaIDByDeviceTypeID(type){
        return request.get(url+'/selectAreaIDByDeviceTypeID',{
            params:{
                type:type
            }//当返回值为数组类型时，一定得用params接收
        })
    }

}

